import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;

import org.omg.PortableInterceptor.DISCARDING;
/*
 * Created by JFormDesigner on Sat Apr 05 19:06:41 IST 2014
 */



/**
 * @author Rahul MU ------
 */
public class TestAppPage1 extends JFrame {
	// my editing
	// JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
	// Generated using JFormDesigner Evaluation license - Rahul MU
	private JLabel label1;
	private JLabel label2;
	private JLabel label3;
	private JTextField textField1;
	private JTextField textField2;
	private JButton button1;
	private JButton button2;
	private JPanel panel1;
	private JLabel label4;
	private JTextField textField3;
		// JFormDesigner - End of variables declaration  //GEN-END:variables
		static boolean strButtonStatus = false;
		static boolean stpButtonStatus = false;
		static long pollingIntervel = 0;
		static long startingValue = 0;
		int rateChange = 1;
		//String IPAddress ="10.0.0.1" ;
	
	public TestAppPage1() {
		initComponents();
	}

	private void button1ActionPerformed(ActionEvent e) {
		pollingIntervel  = (long) Double.parseDouble(textField1.getText());
		startingValue = (long) Double.parseDouble(textField2.getText());
		rateChange = Integer.parseInt(textField3.getText());
		//IPAddress = textField4.getText();
		
		//System.out.println(startingValue);
		strButtonStatus = true;
		stpButtonStatus = false;
		// TODO add your code here
	}

	private void button2ActionPerformed(ActionEvent e) {
		strButtonStatus = false;
		stpButtonStatus = true;
		//dispose();
		// TODO add your code here
	}

	private void initComponents() {
		// JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
		// Generated using JFormDesigner Evaluation license - Rahul MU
		ResourceBundle bundle = ResourceBundle.getBundle("testing");
		label1 = new JLabel();
		label2 = new JLabel();
		label3 = new JLabel();
		textField1 = new JTextField();
		textField2 = new JTextField();
		button1 = new JButton();
		button2 = new JButton();
		panel1 = new JPanel();
		label4 = new JLabel();
		textField3 = new JTextField();

		//======== this ========
		setTitle(bundle.getString("this.title"));
		Container contentPane = getContentPane();
		contentPane.setLayout(null);

		//---- label1 ----
		label1.setText(bundle.getString("label1.text"));
		label1.setFont(new Font("Times New Roman", Font.BOLD | Font.ITALIC, 16));
		contentPane.add(label1);
		label1.setBounds(75, 10, 195, 25);

		//---- label2 ----
		label2.setText(bundle.getString("label2.text"));
		label2.setFont(new Font("Times New Roman", Font.BOLD | Font.ITALIC, 14));
		contentPane.add(label2);
		label2.setBounds(10, 60, 130, 30);

		//---- label3 ----
		label3.setText(bundle.getString("label3.text"));
		label3.setFont(new Font("Times New Roman", Font.BOLD | Font.ITALIC, 14));
		contentPane.add(label3);
		label3.setBounds(10, 105, 130, 30);

		//---- textField1 ----
		textField1.setText(bundle.getString("textField1.text"));
		contentPane.add(textField1);
		textField1.setBounds(175, 65, 110, 25);

		//---- textField2 ----
		textField2.setText(bundle.getString("textField2.text"));
		contentPane.add(textField2);
		textField2.setBounds(175, 110, 110, 25);

		//---- button1 ----
		button1.setText(bundle.getString("button1.text"));
		button1.setFont(new Font("Times New Roman", Font.BOLD, 14));
		button1.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				button1ActionPerformed(e);
				button1ActionPerformed(e);
				button1ActionPerformed(e);
			}
		});
		contentPane.add(button1);
		button1.setBounds(35, 245, 105, 28);

		//---- button2 ----
		button2.setText(bundle.getString("button2.text"));
		button2.setFont(new Font("Times New Roman", Font.BOLD, 14));
		button2.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				button2ActionPerformed(e);
				button2ActionPerformed(e);
			}
		});
		contentPane.add(button2);
		button2.setBounds(150, 245, 105, 28);

		//======== panel1 ========
		{

			// JFormDesigner evaluation mark
			panel1.setBorder(new javax.swing.border.CompoundBorder(
				new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
					"JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
					javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12),
					java.awt.Color.red), panel1.getBorder())); panel1.addPropertyChangeListener(new java.beans.PropertyChangeListener(){public void propertyChange(java.beans.PropertyChangeEvent e){if("border".equals(e.getPropertyName()))throw new RuntimeException();}});

			panel1.setLayout(null);

			{ // compute preferred size
				Dimension preferredSize = new Dimension();
				for(int i = 0; i < panel1.getComponentCount(); i++) {
					Rectangle bounds = panel1.getComponent(i).getBounds();
					preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
					preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
				}
				Insets insets = panel1.getInsets();
				preferredSize.width += insets.right;
				preferredSize.height += insets.bottom;
				panel1.setMinimumSize(preferredSize);
				panel1.setPreferredSize(preferredSize);
			}
		}
		contentPane.add(panel1);
		panel1.setBounds(new Rectangle(new Point(10, 5), panel1.getPreferredSize()));

		//---- label4 ----
		label4.setText(bundle.getString("label4.text"));
		label4.setFont(new Font("Times New Roman", Font.BOLD | Font.ITALIC, 14));
		contentPane.add(label4);
		label4.setBounds(10, 155, 130, 29);

		//---- textField3 ----
		textField3.setText(bundle.getString("textField3.text"));
		contentPane.add(textField3);
		textField3.setBounds(175, 155, 110, 25);

		{ // compute preferred size
			Dimension preferredSize = new Dimension();
			for(int i = 0; i < contentPane.getComponentCount(); i++) {
				Rectangle bounds = contentPane.getComponent(i).getBounds();
				preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
				preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
			}
			Insets insets = contentPane.getInsets();
			preferredSize.width += insets.right;
			preferredSize.height += insets.bottom;
			contentPane.setMinimumSize(preferredSize);
			contentPane.setPreferredSize(preferredSize);
		}
		pack();
		setLocationRelativeTo(getOwner());
		// JFormDesigner - End of component initialization  //GEN-END:initComponents
	}

	
	
	
	

	// JForm Function 
	public long getPollingIntervel(){
		return pollingIntervel;
	}
	public long getStartingValue(){
		return startingValue;
	}
	public int getRateOfChange(){
		return rateChange;
	}
	public boolean getStartButtonStatus(){
		return strButtonStatus;
	}
	public boolean getStopButtonStatus(){
		return stpButtonStatus;
	}
}
